#ifndef __MARS_GRAPHICS_RENDERTARGET_H__
#define __MARS_GRAPHICS_RENDERTARGET_H__

#include "MarsObject.h"

using namespace Core;

namespace Graphics
{

class RenderTarget : public Object
{
public:
									RenderTarget( uint32 iWidth, uint32 iHeight );
									~RenderTarget();

	bool							Create();
	void							Delete();

	ID3D11ShaderResourceView*		GetNativeTextureSRV();

	void							Bind();

private:
	uint32							m_iWidth;
	uint32							m_iHeight;

	ID3D11ShaderResourceView*		m_pDepthMapSRV;
	ID3D11DepthStencilView*			m_pDepthMapDSV;

	D3D11_VIEWPORT					m_viewport;
};

inline RenderTarget::RenderTarget( uint32 iWidth, uint32 iHeight )
	: m_iWidth( iWidth )
	, m_iHeight( iHeight )
	, m_pDepthMapSRV( NULL )
	, m_pDepthMapDSV( NULL )
{
	m_viewport.TopLeftX = 0.0f;
	m_viewport.TopLeftY = 0.0f;
	m_viewport.Width    = static_cast< float >( iWidth );
	m_viewport.Height   = static_cast< float >( iHeight );
	m_viewport.MinDepth = 0.0f;
	m_viewport.MaxDepth = 1.0f;
}

inline RenderTarget::~RenderTarget()
{
	Delete();
}

inline ID3D11ShaderResourceView* RenderTarget::GetNativeTextureSRV()
{
	return m_pDepthMapSRV;
}

} // end of namespace Graphics

#endif // end of #ifndef __MARS_GRAPHICS_RENDERTARGET_H__